const Koa = require('koa');
const fs = require('fs');
const app = new Koa();

const main = ctx => {
  if (ctx.url === '/') {
    ctx.body = 'Hello, World!';
  } else if (ctx.url === '/about') {
    // const content = fs.readFileSync('about.html');
    // ctx.body = content.toString();

    const content = fs.createReadStream('./about.html');
    ctx.body = content;
  } else if (ctx.url === '/home') {
    ctx.body = 'Welcome to our Homepage';
  }
};

app.use(main);

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});
